////
////  NIBaseBusinessController.m
////  gweAD
////
////  Created by navinfo air on 2016/10/31.
////  Copyright © 2016年 mengy. All rights reserved.
////
//
//#import "NIBaseBusinessController.h"
//#import "GWUserModelDataManager.h"
//#import "NIBaseRequest.h"
//#import "MainViewController.h"
//#import "NILoadingView.h"
//
//@interface NIBaseBusinessController ()
//
//@end
//
//@implementation NIBaseBusinessController
//
//- (void)logOut{
////    [NILoadingView close];
////    [[NINotificationView getNotificationView] removeAllNotification];
////
////    //删除tokenID相关数据（DB）（自动登录的标示）
////    GWUserModelDataManager *manager = [[GWUserModelDataManager alloc] init];
////    GWUserModel *userModel = [[GWUserModel alloc] init];
////    AppContext *appContext = [AppContext getInstance];
////    userModel.userId = appContext.userModel.userId;
////
////    GWUserModel *presentUserModel = appContext.userModel;
////    presentUserModel.userToken = @"";
////
////    [manager updateCoreDataWithOriginalUserModel:userModel andPresentUserModel:presentUserModel];
////
////    [NIBaseRequest setSessionTokenID:@""];
//    
//    //清理跳过设置车牌号
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"SKIP_SETTING_LICENSE"];
//    [appContext clearContext];
//}
//
//- (void)startGetMessage{
//    NSArray *controllerArray = [UIApplication sharedApplication].keyWindow.rootViewController.childViewControllers;
//    UIViewController *c;
//    for (int i = 0; i < [controllerArray count]; i++) {
//        c = [controllerArray objectAtIndex:i];
//        if ([c isKindOfClass:[MainViewController class]]) {
//            [(MainViewController *)c getMessage];
//            break;
//        }
//    }
//}
//
//- (void)startVehicleData{
//    NSArray *controllerArray = [UIApplication sharedApplication].keyWindow.rootViewController.childViewControllers;
//    UIViewController *c;
//    for (int i = 0; i < [controllerArray count]; i++) {
//        c = [controllerArray objectAtIndex:i];
//        if ([c isKindOfClass:[MainViewController class]]) {
//            [(MainViewController *)c getVehicleData];
//            break;
//        }
//    }
//}
//
//- (void)viewDidDealloc{
//    
//}
//
////- (NSString *)showNotification:(NSString *)title notificationType:(NINotificationType)type{
////    NINotificationView *notificationView = [NINotificationView getNotificationView];
////    NINotificationObject *notification = [[NINotificationObject alloc] init];
////    notification.title = title;
////    notification.notificationType = type;
////    notification.buttonText = @"OK";
////    [notificationView addNotification:notification];
////    return notification.notificationId;
////}
//
////- (BOOL)changeNotification:(NSString *)title notificationType:(NINotificationType)type notificationID:(NSString *)ID{
////    NINotificationView *notificationView = [NINotificationView getNotificationView];
////    NINotificationObject *notification = [[NINotificationObject alloc] init];
////    notification.title = title;
////    notification.notificationType = type;
////    notification.buttonText = @"OK";
////    return [notificationView changeNotificationStatus:notification NotificationId:ID];
////}
//
////- (void)removeNotification:(NSString *)notificationID{
////    NINotificationView *notificationView = [NINotificationView getNotificationView];
////    [notificationView removeNotificationById:notificationID];
////}
//
//#pragma mark - save message state
//- (void)setMessageState:(BOOL)haveNewMessage messageType:(enum NI_MESSAGE_TYPE)type{
//    NSString *userAccount;
//    if (DEMO_WORKING) {
//        userAccount = DEMO_ACCOUNT;
//    }else{
//        AppContext *appContext = [AppContext getInstance];
//        userAccount = appContext.userModel.userAccount;
//    }
//    [[NSUserDefaults standardUserDefaults] setBool:haveNewMessage forKey:[NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,type]];
//}
//
//- (void)clearMessageState{
//    NSString *userAccount;
//    if (DEMO_WORKING) {
//        userAccount = DEMO_ACCOUNT;
//    }else{
//        AppContext *appContext = [AppContext getInstance];
//        userAccount = appContext.userModel.userAccount;
//    }
//    NSString *messageKey0 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_SYSTEM];
//    NSString *messageKey1 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_ELEC_FENCE];
//    NSString *messageKey2 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_MAINTAIN];
//    NSString *messageKey3 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_CHARGE];
//    NSString *messageKey4 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_APPT_AIR];
//    NSString *messageKey5 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_VEHICLE_ALARM];
//    NSString *messageKey6 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_CALL_CENTRE_FEEDBACK];
//    NSString *messageKey7 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_T_SERVICE_CHANGE];
//    NSString *messageKey8 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_E_SERVICE_CHANGE];
//    NSString *messageKey9 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_SERVICE_FEEDBACK];
//    
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey0];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey1];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey2];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey3];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey4];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey5];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey6];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey7];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey8];
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:messageKey9];
//    
//
//}
//
//- (BOOL)hasNewMessage:(enum NI_MESSAGE_TYPE)type{
//    NSString *userAccount;
//    if (DEMO_WORKING) {
//        userAccount = DEMO_ACCOUNT;
//    }else{
//        AppContext *appContext = [AppContext getInstance];
//        userAccount = appContext.userModel.userAccount;
//    }
//    
//    return [[NSUserDefaults standardUserDefaults] boolForKey:[NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,type]];
//}
//
//- (BOOL)hasNewMessage{
//    NSString *userAccount;
//    if (DEMO_WORKING) {
//        userAccount = DEMO_ACCOUNT;
//    }else{
//        AppContext *appContext = [AppContext getInstance];
//        userAccount = appContext.userModel.userAccount;
//    }
//    NSString *messageKey0 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_SYSTEM];
//    NSString *messageKey1 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_ELEC_FENCE];
//    NSString *messageKey2 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_MAINTAIN];
//    NSString *messageKey3 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_CHARGE];
//    NSString *messageKey4 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_APPT_AIR];
//    NSString *messageKey5 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_TYPE_VEHICLE_ALARM];
//    
//    NSString *messageKey6 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_CALL_CENTRE_FEEDBACK];
//    NSString *messageKey7 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_T_SERVICE_CHANGE];
//    NSString *messageKey8 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_E_SERVICE_CHANGE];
//    NSString *messageKey9 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_SERVICE_FEEDBACK];
//    
//    NSString *messageKey10 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_VEHICLE_MANAGE_COMMON];
//    NSString *messageKey11 = [NSString stringWithFormat:@"%@%@%d",USERDEFAULTSKEY_NEWMESSAGE,userAccount,MESSAGE_ACCOUNT_ABNORMAL_COMMON];
//    
//    
//    if ([[NSUserDefaults standardUserDefaults] boolForKey:messageKey0]){
//        return YES;
//    }
//    if ([[NSUserDefaults standardUserDefaults] boolForKey:messageKey1]){
//        return YES;
//    }
//    if ([[NSUserDefaults standardUserDefaults] boolForKey:messageKey2]){
//        return YES;
//    }
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey3]){
//        return YES;
//    }
//    
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey4]){
//        return YES;
//    }
//    
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey5]) {
//        return YES;
//    }
//    
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey6]) {
//        return YES;
//    }
//    
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey7]) {
//        return YES;
//    }
//    
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey8]) {
//        return YES;
//    }
//    
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey9]) {
//        return YES;
//    }
//    
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey10]) {
//        return YES;
//    }
//    if([[NSUserDefaults standardUserDefaults] boolForKey:messageKey11]) {
//        return YES;
//    }
//    return NO;
//}
//
//@end
